package com.xiaoyun.service.impl;

import com.xiaoyun.service.FastdfsService;
import com.xiaoyun.utils.FastDFSClient;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@Service
@RequiredArgsConstructor
public class FastdfsServiceImpl implements FastdfsService {

    private final FastDFSClient fastDFSClient;

    @Override
    public String upload(MultipartFile multipartFile) {
        String path = "";
        try {
            path = fastDFSClient.uploadBase64(multipartFile);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return path;
    }
}
